import request from '@/axios';

export const getList = () => {
  return request({
    url: '/position/team/list',
    method: 'get',
  });
};

export const getDetail = id => {
  return request({
    url: '/position/team/detail',
    method: 'get',
    params: {
      id,
    },
  });
};

export const remove = ids => {
  return request({
    url: '/position/team/remove',
    method: 'post',
    params: {
      ids,
    },
  });
};

export const add = row => {
  return request({
    url: '/position/team/save',
    method: 'post',
    data: row,
  });
};

export const update = row => {
  return request({
    url: '/position/team/update',
    method: 'post',
    data: row,
  });
};

export const getTeamList = () => {
  return request({
    url: '/position/team/listNoPage',
    method: 'get',
  });
};

export const getSequenceList = teamId => {
  return request({
    url: '/position/sequence/listByTeamId',
    method: 'get',
    params: {
      teamId,
    },
  });
};

export const sort = row => {
  return request({
    url: '/position/team/sort',
    method: 'post',
    data: row,
  });
};

export const getSequenceDetail = id => {
  return request({
    url: '/position/sequence/detail',
    method: 'get',
    params: {
      id,
    },
  });
};

export const removeSequence = ids => {
  return request({
    url: '/position/sequence/remove',
    method: 'post',
    params: {
      ids,
    },
  });
};

export const addSequence = row => {
  return request({
    url: '/position/sequence/save',
    method: 'post',
    data: row,
  });
};

export const updateSequence = row => {
  return request({
    url: '/position/sequence/update',
    method: 'post',
    data: row,
  });
};

export const getPositionSequenceList = SequenceId => {
  return request({
    url: '/position/positionSequence/listBySequenceId',
    method: 'get',
    params: {
      SequenceId,
    },
  });
};

export const getPositionSequenceLists = params => {
  return request({
    url: '/position/position/list',
    method: 'get',
    params,
  });
};

export const addPositionSequence = data => {
  return request({
    url: '/position/positionSequence/save',
    method: 'post',
    data,
  });
};

export const editPositionSequence = data => {
  return request({
    url: '/position/positionSequence/update',
    method: 'post',
    data,
  });
};

export const removePositionSequence = ids => {
  return request({
    url: '/position/positionSequence/remove',
    method: 'post',
    params: {
      ids,
    },
  });
};

export const detailPositionSequence = id => {
  return request({
    url: '/position/positionSequence/detail',
    method: 'get',
    params: {
      id,
    },
  });
};

export const isDirection = (isDirection, data) => {
  return request({
    url: '/position/position/list',
    method: 'get',
    params: {
      isDirection,
    },
    data,
  });
};

export const addDirection = data => {
  return request({
    url: '/position/direction/add',
    method: 'post',
    data,
  });
};

export const getMap = sequenceId => {
  return request({
    url: '/position/positionInstance/getMap',
    method: 'get',
    params: {
      sequenceId,
    },
  });
};

export const getMapWithTeam = () => {
  return request({
    url: '/position/positionInstance/getUserTeamAndSequence',
    method: 'get',
  });
};
